package com.myfum.wingplayer.components.ui
{
	import com.myfum.wingplayer.model.ProgramLocator;
	import com.myfum.wingplayer.utils.TaskManager;
	
	import flash.events.Event;
	
	import org.robotlegs.mvcs.Mediator;
	
	public class ProjectMediator extends Mediator
	{
		[Inject]
		public var view:Program;
		[Inject]
		public var task:TaskManager;
		[Inject]
		public var locator:ProgramLocator;
		
		public function ProjectMediator()
		{
			super();
		}
		
		override public function onRegister():void{
			eventMap.mapListener(locator, Event.CHANGE, onProgramChange);
			
			view.data = locator.currentProgram;
			super.onRegister();
		}
		
		private function onProgramChange(e:Event):void{
			view.data = locator.currentProgram;
		}
	}
}